package org.example.design.Flyweight;

import com.alibaba.fastjson.JSON;
import org.example.design.Flyweight.bean.Activity;
import org.example.design.Flyweight.controller.ActivityController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Classname Test
 * @Description 把不变的东西放在内存里，变得东西单独抽取出来，这样可以加快响应应效率，连接池，线程池一般使用享元模式。
 * ate 2020/11/5 2:56 下午
 * @Created by xiangjd
 */
public class Test {
    private static Logger logger = LoggerFactory.getLogger(Test.class);

    private static ActivityController activityController = new ActivityController();

    @org.junit.Test
    public void getActivity() throws InterruptedException {
        for (int i = 0; i < 10; i++) {
            Long req = 2L;
            Activity activity = activityController.queryActivityInfo(req);
            logger.info("测试结果:{} {}", req + "+" + i, JSON.toJSONString(activity));
            Thread.sleep(1200);
        }
    }
}
